import React from 'react'
import {
    Switch,
    Route,
    Link,
    HashRouter
} from 'react-router-dom'

import Home from './test/Home.jsx'
import B from './test/B.jsx'

class Comment extends React.Component {
    constructor(props) {
        super(props)
        //初始化state
        this.state = {};
    }


    //默认属性
    static defaultProps = {}

    render() {
        return <HashRouter>
            <div>
                <Link to="/home/1">首页</Link><br/>
                <Link to="/b">组件b</Link>
            </div>

            {/*exact表示精确匹配*/}
            <Route path="/home" component={Home} exact/>
            {/*路径参数*/}
            <Route path="/home/:id" component={Home} exact/>
            <hr/>
            <Route path="/b" component={B}/>
        </HashRouter>
    }
}


export default Comment
